/**
 * @created on March 27 2007
 * @author jprieur
 *
 */
package mygui;

import kernel.*;
import objects.*;

import java.awt.event.*;
import java.io.*;
import javax.swing.*;

public class ActionProperties extends AbstractAction
{
    private SimObject _object;
    private SensorNetwork _object2;
    private Simulator _kernel;
		
    public ActionProperties(SimObject object){
	_kernel = Simulator.getSimulator();
	_object = object;
	if(_object instanceof SensorNetwork){
	    putValue(AbstractAction.NAME, ((SensorNetwork)_object).getName());
	}else if(_object instanceof Obstacle){
	    putValue(AbstractAction.NAME, ((Obstacle)_object).getName());
	}else{
	    putValue(AbstractAction.NAME, ((Station)_object).getName());
	}
	putValue(AbstractAction.SHORT_DESCRIPTION,
		 "Open properties window.");
	ImageIcon icon;
	if(object instanceof BaseStation || object instanceof Sink){
	    icon = UIM.createImageIcon("images/base.png","");
	    putValue(AbstractAction.SMALL_ICON, icon);
	}else if(object instanceof MobileStation || object instanceof SensorNetwork){
	    icon = UIM.createImageIcon("images/wireless.png","");
	    putValue(AbstractAction.SMALL_ICON, icon);
	}else if(object instanceof Obstacle){
	    icon = UIM.createImageIcon("images/rectangle.png","");
	    putValue(AbstractAction.SMALL_ICON, icon);
	}
    }
		 
    public void actionPerformed(ActionEvent e){
	if(_object instanceof SensorNetwork){
	    SensorNetworkProperties snprops = new SensorNetworkProperties((SensorNetwork)_object);
	}else if(_object instanceof Sink){
	    SinkProperties sprops = new SinkProperties((Sink)_object);
	}else if(_object instanceof MobileStation){
	    MobileProperties mprops = 
		new MobileProperties((MobileStation)_object);
	}else if(_object instanceof BaseStation){
	    BaseProperties bprops = 
		new BaseProperties((BaseStation)_object);
	}else if(_object instanceof Obstacle){
	    ObstacleProperties oprops = 
		new ObstacleProperties((Obstacle)_object);
	}
    }
}